const router = require('koa-router')()

router.prefix('/users')
//需要创建control文件夹来管理各个路由所需的回调函数
const { loginCtl,registerCtl,modifyPwd,verify,updatePersonal } = require('../controller/userControl')
// 中间件，先进行这里再进行control
const {userValidator, verifyUser, cryptPassword,auth, verifyLogin} = require("../middleware/user.middleware");

//创建login登录接口地址，loginCtl为所需要处理的函数
router.post('/register', userValidator,verifyUser,cryptPassword,registerCtl)
router.post('/login',userValidator,verifyLogin, loginCtl)
router.post('/modifyPwd',auth, cryptPassword, modifyPwd)
router.post('/verify', verify)
router.post('/updatePersonal', updatePersonal)
module.exports = router
